//
//  DataWeekCalendarView.swift
//  MoyoungHome
//
//  Created by 易先生 on 2022/9/21.
//

import UIKit
import MYModule

class CalendarWeekView: View {

	override func makeUI() {
		super.makeUI()
		self.addSubview(weekStackView)
		weekStackView.snp.makeConstraints { make in
			make.top.bottom.equalToSuperview()
			make.leading.equalToSuperview().offset(10)
			make.trailing.equalToSuperview().offset(-10)
		}
	}

	public func updateDatas(datas: [String], textColor: UIColor) {
		weekStackView.removeAllSubViews()
		for title in datas {
			let label = UILabel()
			label.font = Fonts.systemFont(ofSize: 12)
			label.textColor = textColor
			label.textAlignment = .center
			label.text = title
			weekStackView.addArrangedSubview(label)
		}
	}

	private lazy var weekStackView: StackView = {
		let weekStackView = StackView()
		weekStackView.axis = .horizontal
		weekStackView.distribution = .fillEqually
		weekStackView.alignment = .center
		weekStackView.spacing = 5
		return weekStackView
	}()

}
